package com.zc.im.common.r2dbc.event.callback;

import com.zc.im.common.r2dbc.domain.AbstractBase;
import org.reactivestreams.Publisher;
import org.springframework.data.r2dbc.mapping.OutboundRow;
import org.springframework.data.r2dbc.mapping.event.AfterSaveCallback;
import org.springframework.data.relational.core.sql.SqlIdentifier;
import reactor.core.publisher.Mono;

/**
 * Project：im
 * Date：2022/4/20
 * Time：14:03
 * Description：保存后回调
 *
 * @author Challen.Zhang
 * @version 1.0
 */
public class BaseAfterSaveCallback implements AfterSaveCallback<AbstractBase> {
    @Override
    public Publisher<AbstractBase> onAfterSave(AbstractBase entity, OutboundRow outboundRow, SqlIdentifier table) {
        entity.setNewObj(false);
        return Mono.just(entity);
    }
}
